Conversation
rescript
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f4f487f3f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 165476741a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a937c43f73
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c4f4a87c2d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let warning_attribute_iterator = | ||
| let structure_item self (structure_item : Parsetree.structure_item) = | ||
| (match structure_item.pstr_desc with | ||
| | Pstr_attribute attr -> Builtin_attributes.warning_attribute attr |
There was a problem hiding this comment.
Limit warning prepass to avoid leaking nested scopes
warning_attribute_iterator now applies every Pstr_attribute/Psig_attribute during a full AST walk, but this mutates the global warning state without any restore. Because this prepass runs before typing, non-leading or nested @@warning directives are effectively active from the start of compilation (and can leak outside their intended scope), so warnings in earlier or outer code can be incorrectly suppressed/enabled; for example, a nested module-level @@warning("-32") can silence outer unused-value warnings.
Useful? React with 👍 / 👎.
Fixes #8160.
Symptom
The reported repro was:
With warning
102enabled, this still produced:Root Cause
Warning
102(Bs_polymorphic_comparison) was emitted too late, incompiler/core/lam_compile_primitive.ml.By the time that code ran, local warning scopes created by source attributes such as
@warning("-102")had already been restored. As a result, file-wide warning settings still worked, but expression-level suppression did not affect warning102.Fix
The warning emission was moved into typedtree-to-lambda translation in
compiler/ml/translcore.ml, where it still runs under the relevant source-level warning scopes.Concretely:
102is emitted when the polymorphic comparison primitive is selected during translationcompiler/core/lam_compile_primitive.mlThis keeps warning
102enabled by default, while making local suppression behave correctly.Tests
Regression tests were added under
tests/build_tests/super_errors/:warning102_expr_attribute.reswarning102_structure_attribute.reswarning102_value_attribute.resThese cover:
@warning("-102")@@warning("-102")let v = @warning("-102") compareAll corresponding snapshots are empty, because successful suppression means there is no warning output.
Result
After the fix:
@warning("-102")works for local polymorphic comparison expressions@@warning("-102")still works102still appears normally when no suppression is present